

package com.hazelcast.client.impl.protocol.codec.builtin;

import com.hazelcast.client.impl.protocol.ClientMessage;

import java.util.List;

import static com.hazelcast.client.impl.protocol.codec.builtin.FixedSizeTypesCodec.DOUBLE_SIZE_IN_BYTES;

public final class ListCNDoubleCodec {

    private ListCNDoubleCodec() {
    }

    public static void encode(ClientMessage clientMessage, Iterable<Double> items) {
        ListCNFixedSizeCodec.encode(clientMessage, items, DOUBLE_SIZE_IN_BYTES, FixedSizeTypesCodec::encodeDouble);
    }

    public static List<Double> decode(ClientMessage.ForwardFrameIterator iterator) {
        return decode(iterator.next());
    }

    public static List<Double> decode(ClientMessage.Frame frame) {
        return ListCNFixedSizeCodec.decode(frame, DOUBLE_SIZE_IN_BYTES, FixedSizeTypesCodec::decodeDouble);
    }
}
